﻿@using System.Net.Http.Json
@namespace MudBlazor.Docs.Examples

<MudDataGrid Items="@_users" HorizontalScrollbar="true" Bordered="true" Dense="true">
    <Columns>
        <PropertyColumn Property="x => x.Name" StickyLeft="true" />
        <PropertyColumn Property="x => x.Age" />
        <PropertyColumn Property="x => x.FillerColumn" HeaderStyle="white-space:nowrap">
            <HeaderTemplate>
                @((MarkupString)$"This is a really long column{string.Join("", Enumerable.Repeat("&nbsp;", 1000))}...")
            </HeaderTemplate>
        </PropertyColumn>
        <PropertyColumn Property="x => x.Salary" />
        <TemplateColumn StickyRight="true">
            <CellTemplate>
                <MudIconButton Icon="@Icons.Material.Outlined.Edit" Size="@Size.Small" />
            </CellTemplate>
        </TemplateColumn>
    </Columns>
</MudDataGrid>

@code {
    public record User(string Name, int Age, string FillerColumn, decimal Salary);

    private IEnumerable<User> _users = new List<User>
    {
        new User("Sam", 56, "...", 50_000.00M), 
        new User("Alicia", 54, "...", 75_000.00M), 
        new User("Ira", 27, "...", 102_000.00M),
        new User("John", 32, "...", 132_000.00M),
    };
}
